
//1023.驼峰式匹配
class Solution {

    //判断字符串从pos位置后面还有没有大写字符
    bool HaveUpper(string& str,int pos)
    {
        while(pos<str.size())
        {
            if(isupper(str[pos])) return false;
            pos++;
        }
        return true;
    }
public:
    vector<bool> camelMatch(vector<string>& queries, string pattern) {
        int n=pattern.size();
        vector<bool> ret;
        for(auto str:queries)
        {
            int m=str.size();
            int i=0,j=0;
            while(i<n&&j<m)
            {
                if(pattern[i]==str[j]) i++;   //当前字符匹配
                else if(isupper(str[j])) break;  //当前字符是大写但是不匹配
                j++;
            }
            if(i!=n) ret.push_back(false);   
            else ret.push_back(HaveUpper(str,j));  
        }
        return ret;
    }
};